//
//  PasswordViewController.m
//  ZmlMagicTour
//
//  Created by 张明磊 on 14-4-4.
//  Copyright (c) 2014年 张明磊. All rights reserved.
//

#import "PasswordViewController.h"

@interface PasswordViewController ()

@end

@implementation PasswordViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self installView_password];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)installView_password
{
    UIImageView *imageView_background = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [imageView_background setImageScalingWithFileName:@"imageView_background@2x.png"];
    [self.view addSubview:imageView_background];
    
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            UIButton *button_number = [UIButton buttonWithType:UIButtonTypeCustom];
            button_number.frame = CGRectMake(27.5 + 95*j, 163 + 88*i, 75, 75);
            button_number.backgroundColor = [UIColor clearColor];
            [button_number setImageScalingWithFileName:[NSString stringWithFormat:@"button_number%d.png",(j+1) + (i*3)] withState:UIControlStateNormal];
            [button_number setImageScalingWithFileName:[NSString stringWithFormat:@"button_number%d_pressed.png",(j+1) + (i*3)] withState:UIControlStateHighlighted];
            [button_number addTarget:self action:@selector(didClickButton_number:)forControlEvents:UIControlEventTouchUpInside];
            button_number.tag = (j+1) + (i*3);
            [self.view addSubview:button_number];
        }
    }
    
    UIButton *button_number = [UIButton buttonWithType:UIButtonTypeCustom];
    button_number.frame = CGRectMake(27.5 + 95*1, 163 + 88*3, 75, 75);
    button_number.backgroundColor = [UIColor clearColor];
    [button_number setImageScalingWithFileName:@"button_number0.png" withState:UIControlStateNormal];
    [button_number setImageScalingWithFileName:@"button_number0_pressed.png" withState:UIControlStateHighlighted];
    [button_number addTarget:self action:@selector(didClickButton_number:)forControlEvents:UIControlEventTouchUpInside];
    button_number.tag = 0;
    [self.view addSubview:button_number];
    
    //96 103
}

- (void)didClickButton_number:(UIButton *)button_number
{
    NSLog(@"%d",button_number.tag);
}

@end
